package com.transaction.simulate.controller;

import com.transaction.common.base.BaseController;
import com.transaction.common.util.ParamsUtil;
import com.transaction.simulate.model.vo.FundYieldVo;
import com.transaction.simulate.service.IndexService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/index")
public class IndexController extends BaseController {

    private static Logger LOGGER = LoggerFactory.getLogger(IndexController.class);


    @Autowired
    private IndexService indexService;

    /**
     * 查询首页内容
     * @param request
     * @return
     */
    @GetMapping("/getIndexData")
    public Object getIndexData(HttpServletRequest request){
        FundYieldVo fundYieldVo = ParamsUtil.getBeanParam(new FundYieldVo(),request);
        Map<String,Object> data = indexService.getIndexData(fundYieldVo);
        return retResultVo(data);
    }
}
